<%@ page language="java" import="java.util.*,com.hs.core.utils.*,com.hs.chd.action.search.*" pageEncoding="utf-8"%>
<%
  String catagorystr = (String)request.getAttribute("catagorystr");


 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head> 
<%@ include file="../../include.jsp"%> 
<script src='<%=basePath%>thirtpart/jquery/jquery.blockUI.js'></script> 
<script src='<%=basePath%>app/js/hs.search.js'></script>  
<script src='<%=basePath%>thirtpart/xhEditor1.14/xheditor-1.1.14-zh-cn.min.js'></script> 
<script src='<%=basePath%>dwr/interface/summdwr.js'></script> 
<style>.tac{text-align:center}</style>
<script language=JavaScript> 
 function setHiddenDisname(id,disname){
 	document.getElementById("disid").value = id;
 	document.getElementById("disname").innerHTML = disname;
 	$("#summtext").val("");
 	document.getElementById("cataid").value = "";
   document.getElementById("summid").value = "";
 }
  function opencatagory(catatype,cataname){
   var disid = document.getElementById("disid").value;
   if("" == disid){
      alert("请先选择疾病名称！");
      return;
   }
   document.getElementById("cataname").innerHTML = "-->" + cataname;
   document.getElementById("cataid").value = catatype;
   document.getElementById("summid").value = "";
   $("#summtext").val("");
   summdwr.querySummBydisid(disid,catatype,callback4displaycontent);
 }
 function callback4displaycontent(htmlstr){
 
    var datastr = htmlstr;
    var dataarr = datastr.split("#");
    var idstr = dataarr[0];
    var cstr = dataarr[1];
    var datestr = dataarr[2]; 
    if("" != idstr){
      document.getElementById("summid").value = idstr;
    }else{
      document.getElementById("summid").value = "";
    }
    if("" != datestr){ 
      document.getElementById("datestr").innerHTML = datestr;
    }else{
      document.getElementById("datestr").innerHTML = "";
    }
     if("" != cstr){
       $("#summtext").val(cstr);
     }else{
         $("#summtext").val("");
     }
 }
 function saveSumm(){
 	var disid = document.getElementById("disid").value;
 	var cataid = document.getElementById("cataid").value;
 	var summid = document.getElementById("summid").value;
 	var content = $("#summtext").val();
 	if("" == disid){
      alert("请先选择疾病名称！");
      return;
    }
    if("" == cataid){
      alert("请先选择综述二级目录！");
      return;
    }
    if("" == content){
      alert("请先填写综述内容！");
      return;
    }
    
    if("" != summid)
        summdwr.updateSummContent(summid,content,callback4insertsumm);
     else{
        summdwr.insertSummContent(disid,cataid,content,callback4insertsumm); 
     }
 }
 function callback4insertsumm(datastr){
    alert('保存成功!');
    var dataarr = datastr.split("#");
    var idstr = dataarr[0];
    var datestr = dataarr[1];
    document.getElementById("summid").value=idstr;
     if("" != datestr){ 
      document.getElementById("datestr").innerHTML = datestr;
    }else{
      document.getElementById("datestr").innerHTML = "";
    }
 }
 function previewsumm(){
   var disid = document.getElementById("disid").value;
   if("" == disid){
      alert("请先选择疾病名称！");
      return;
   }
   openwindow('<%=basePath%>summarize/summview.do?tcmid='+disid,'800','600','');
 }
 
 function submitSumm(){ 
 	var summid = document.getElementById("summid").value;
 	if('' == summid){
 		alert("请先填写综述内容并保存后再进行提交！");
        return;
 	}else{ 
        summdwr.submitSummContent(summid,callback4submitsumm); 
    }
    
 }
 function callback4submitsumm(data){
 	alert("综述内容提交成功!");
 }

</script>
</head>
<body>
<dl class="treeWrap">
    <dt><input type=button onclick="previewsumm();" class="btn btn-primary" value="预览"/>&nbsp;&nbsp;综述二级目录</dt>
    <dd>
       	<%=catagorystr %>
    </dd>
    <input type="hidden" value="" name="disid" id="disid"/>
    <input type="hidden" value="" name="cataid" id="cataid"/>
    <input type="hidden" value="" name="summid" id="summid"/>
</dl>
<div class="contsumm">
<table border="0" cellpadding="0" cellspacing="0" width="100%" >
              <tr>
                <td width="60%"> 
                    当前位置：<span id="disname"></span><span id="cataname"></span> 
                 
                </td>
                 <td width="20%"> 
                   更新日期：<span id="datestr"></span>
                 
                </td>
                  <td align=right > 
                   <input type="button" style="margin-right:20px;" onclick="saveSumm()" class="btn btn-primary" value="保存" /> 
                   <input type="button" style="margin-right:20px;" onclick="submitSumm()" class="btn btn-primary" value="提交" /> 
                </td>
              </tr>
              <tr>
                <td colspan=3>
                	 &nbsp;
                </td>
              </tr>
               <tr>
                <td colspan=3>
                	<textarea id="summtext" name="summtext" class="" rows="35" cols="80" style="width:99%"></textarea>

                </td>
              </tr>
</table>

</div>
</body>
</html>
<script>
 
   
</script>
